<%@ page language="java" import="java.util.*,com.hs.auth.model.*,com.hs.dnms.model.*" pageEncoding="utf-8"%>
 <%
    DnmsDisease disobj = (DnmsDisease)request.getAttribute("disobj"); 
    String disid = (String)request.getAttribute("disid")==null?"":(String)request.getAttribute("disid");
  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="../../include.jsp"%>  
<script language="javascript" type="text/javascript" src="<%=basePath%>common/uploadify/jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript" src="<%=basePath%>common/javascripts/My97DatePicker/WdatePicker.js"></script>
<script language="javascript" type="text/javascript" src="<%=basePath%>common/uploadify/jquery.uploadify.v2.1.4.js"></script>
<script type="text/javascript" src="<%=basePath%>common/uploadify/swfobject.js"></script>
<LINK rel=stylesheet type=text/css href="<%=basePath%>common/uploadify/uploadify.css"/>  
<script src='<%=basePath%>dwr/interface/dataProhelper.js'></script>  

<script language="javascript" type="text/javascript">
function dataPro(id){
	window.location.href="";

}
  
/**并发症信息保存*/
function saveParainfo(id){
 	var paraname = document.getElementById("paraname").value; 
 	if("" == id){
 		alert("请先选择该并发症对应的疾病!");
 		return ;
 	}
	if(isNull(paraname)){
		alert("请输入并发症名称！");
		return; 
    }
    dataProhelper.addParaDis(paraname,'',id,callback4addPara);
}
function callback4addPara(data){ 
	   var index = data.indexOf("$");
       var paraid = data.substring(0,index);
       var paraname = data.substring(index+1);  
       var str = "<span id=para_"+paraid+"><font size='5'>" + paraname+"</font>&nbsp;&nbsp;<a href='javaScript:delPara("+paraid+");'>删除</a>&nbsp;&nbsp;</span>";
       var objHtml = document.getElementById("paras");
       var temp = objHtml.innerHTML + str;
       objHtml.innerHTML = temp; 
       document.getElementById("paraname").value='';
       document.getElementById("paraname").focus();
       
       alert('并发症信息保存成功！');   
}
function delPara(id){
	if(confirm("确认要删除该并发症吗？")){
    		dataProhelper.delParaDis(id,callback4delPara);
    }
}
function callback4delPara(data){   
	document.getElementById("para_"+data).style.display="none"; 
}
</script>
</head>
<body>
 
<div class="deta_proce" style="border-top:none;margin-left:0"> 
    <div>
        <table border="0" cellspacing="0" cellpadding="0"  class="atta_tab">
          <caption>并发症信息</caption> 
          <tr>
	            <td id="paras">
           <%
            if(null != disobj && !(disobj.getParaset().isEmpty())){  
                    Iterator paraiter = disobj.getParaset().iterator(); 
                   while(paraiter.hasNext()){ 
          	             DnmsParadis para = (DnmsParadis)paraiter.next();
          	            
          	             Long pid = para.getId(); 
          	             out.print("<span id=para_"+pid+"><font size='5'>"+para.getParadisname()+"</font>");
          	             
          	             out.print("<a href=javaScript:delPara('"+pid+"');>");
          	             out.print(" 删 除 </a>"); 
           }}else{ 
              } %> 
           </td> 
	          </tr> 
        </table>
         <table border="0" cellspacing="0" cellpadding="0"> 
          <tr>
            <td width="20%">并发症：</td> 
            <td><input type="text" name="paraname" id="paraname" style="width:99%"/></td>
            <td width="15%"><input onclick="saveParainfo('<%=disobj==null?disid:disobj.getId() %>')" type="button" class="but_3" style="border:none" value=" 保存 " /></td>
          </tr>  
           
        </table>  
    </div>
</div>
</body>
</html>

